<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Footer Menu</title>
<meta name="viewport" content="width=device-width,initial-scale=1" /> 
<link rel="stylesheet" href="/css/jquery.mobile-1.4.5.min.css"/>
<script src="/js/jquery-1.11.0.js"></script>
<script src="/js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="footer" data-position="fixed" data-id="footernav" data-position="fixed" data-tap-toggle="false">
	<div data-role="navbar">
		<ul id="menu-list">
			<li onclick="window.parent.location.href='http://666bbb.net';" location="http://666bbb.net" id="index_li"><a href="http://666bbb.net" class="ui-btn-active" target="_top" id="index_menu">Hi</a></li>
			<!--  
			<li onclick="window.parent.location.href='http://tryit.666bbb.net';" location="http://tryit.666bbb.net" id="tryit_li"><a href="http://tryit.666bbb.net" target="_top" id="tryit_menu">TryIt</a></li>
			-->
			<li onclick="window.parent.location.href='http://666bbb.net/books/';" location="http://666bbb.net/books/" id="books_li"><a href="http://666bbb.net/books/" target="_top" id="books_menu">Books</a></li>
			<li onclick="window.parent.location.href='http://funny.666bbb.net';" location="http://funny.666bbb.net" id="funny_li"><a href="http://funny.666bbb.net" target="_top" id="funny_menu">Funny</a></li>
			<li onclick="window.parent.location.href='http://666bbb.net/game/';" location="http://666bbb.net/game/" id="game_li"><a href="http://666bbb.net/game/" target="_top" id="game_menu">Game</a></li>
			<li onclick="window.parent.location.href='http://666bbb.net/news/';" location="http://666bbb.net/news/" id="news_li"><a href="http://666bbb.net/news/" target="_top" id="news_menu">News</a></li>
			<!--  
			<li onclick="window.parent.location.href='http://666bbb.net/apps/';" location="http://666bbb.net/apps/" id="apps_li" style="display:none"><a href="http://666bbb.net/apps/" target="_top" id="apps_menu">Apps</a></li>
			-->
		</ul>
	</div>
</div>
</body>
</html>
<script src="/js/config/config.js"></script>
<script>
document.domain = domain;
String.prototype.startWith=function(str){     
  var reg=new RegExp("^"+str);     
  return reg.test(this);        
}
function updateClickUrl(){
	$("#index_li").attr("onclick","window.parent.location.href='"+siteUrl+"';");
	$("#index_li").attr("location",siteUrl);
	$("#index_menu").attr("href",siteUrl);
	
	$("#news_li").attr("onclick","window.parent.location.href='"+siteUrl+"/news/';");
	$("#news_li").attr("location",siteUrl+"/news/");
	$("#news_menu").attr("href",siteUrl+"/news/");
	
	$("#game_li").attr("onclick","window.parent.location.href='"+siteUrl+"/game/';");
	$("#game_li").attr("location",siteUrl+"/game/");
	$("#game_menu").attr("href",siteUrl+"/game/");
	
	$("#apps_li").attr("onclick","window.parent.location.href='"+siteUrl+"/apps/';");
	$("#apps_li").attr("location",siteUrl+"/apps/");
	$("#apps_menu").attr("href",siteUrl+"/apps/");
	
	$("#books_li").attr("onclick","window.parent.location.href='"+siteUrl+"/books/';");
	$("#books_li").attr("location",siteUrl+"/books/");
	$("#books_menu").attr("href",siteUrl+"/books/");
	
	$("#funny_li").attr("onclick","window.parent.location.href='"+funnyUrl+"';");
	$("#funny_li").attr("location",funnyUrl);
	$("#funny_menu").attr("href",funnyUrl);
	
	$("#tryit_li").attr("onclick","window.parent.location.href='"+tryItUrl+"';");
	$("#tryit_li").attr("location",tryItUrl);
	$("#tryit_menu").attr("href",tryItUrl);
}
$(document).ready(function(){ 
	var pathname = window.parent.location.pathname;
	var host = window.parent.location.host;
	
	updateClickUrl();
	//console.log("pathname:"+pathname);
	//console.log("host:"+host);
	//console.log(host.startWith("localhost"));
	/*
	$("#index_menu").attr("href",siteUrl);
	$("#news_menu").attr("href",siteUrl+"/news/");
	$("#game_menu").attr("href",siteUrl+"/game/");
	$("#apps_menu").attr("href",siteUrl+"/apps/");
	*/
	if((host==domain || host.startWith("127.0.0.1") || host.startWith("localhost")) && (pathname=="/" || pathname=="/sitesInfo")){
		console.log("index");
		$("#index_menu").attr("class","ui-btn-active ui-link ui-btn");
		$("#news_menu").attr("class","ui-link ui-btn");
		$("#funny_menu").attr("class","ui-link ui-btn");
		$("#game_menu").attr("class","ui-link ui-btn");
		$("#apps_menu").attr("class","ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-link ui-btn");
		$("#books_menu").attr("class","ui-link ui-btn");
	}else if((host==domain || host.startWith("127.0.0.1") || host.startWith("localhost")) && pathname.startWith("/news/")){
		console.log("news index");
		$("#index_menu").attr("class","ui-link ui-btn");
		$("#news_menu").attr("class","ui-btn-active ui-link ui-btn");
		$("#funny_menu").attr("class","ui-link ui-btn");
		$("#game_menu").attr("class","ui-link ui-btn");
		$("#apps_menu").attr("class","ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-link ui-btn");
		$("#books_menu").attr("class","ui-link ui-btn");
	}else if((host==domain || host.startWith("127.0.0.1") || host.startWith("localhost")) && pathname.startWith("/game/")){
		console.log("game index");
		$("#index_menu").attr("class","ui-link ui-btn");
		$("#news_menu").attr("class","ui-link ui-btn");
		$("#funny_menu").attr("class","ui-link ui-btn");
		$("#game_menu").attr("class","ui-btn-active ui-link ui-btn");
		$("#apps_menu").attr("class","ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-link ui-btn");
		$("#books_menu").attr("class","ui-link ui-btn");
	}else if((host==domain || host.startWith("127.0.0.1") || host.startWith("localhost")) && pathname.startWith("/apps/")){
		console.log("apps index");
		$("#index_menu").attr("class","ui-link ui-btn");
		$("#news_menu").attr("class","ui-link ui-btn");
		$("#funny_menu").attr("class","ui-link ui-btn");
		$("#game_menu").attr("class","ui-link ui-btn");
		$("#apps_menu").attr("class","ui-btn-active ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-link ui-btn");
		$("#books_menu").attr("class","ui-link ui-btn");
	}else if(host=="funny."+domain){
		console.log("funny index");
		$("#index_menu").attr("class","ui-link ui-btn");
		$("#news_menu").attr("class","ui-link ui-btn");
		$("#funny_menu").attr("class","ui-btn-active ui-link ui-btn");
		$("#game_menu").attr("class","ui-link ui-btn");
		$("#apps_menu").attr("class","ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-link ui-btn");
		$("#books_menu").attr("class","ui-link ui-btn");
	}else if(host=="tryit."+domain){
		console.log("tryit index");
		$("#index_menu").attr("class","ui-link ui-btn");
		$("#news_menu").attr("class","ui-link ui-btn");
		$("#funny_menu").attr("class","ui-link ui-btn");
		$("#game_menu").attr("class","ui-link ui-btn");
		$("#apps_menu").attr("class","ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-btn-active ui-link ui-btn");
		$("#books_menu").attr("class","ui-link ui-btn");
	}else if((host==domain || host.startWith("127.0.0.1") || host.startWith("localhost")) && pathname.startWith("/books/")){
		console.log("books index");
		$("#index_menu").attr("class","ui-link ui-btn");
		$("#news_menu").attr("class","ui-link ui-btn");
		$("#funny_menu").attr("class","ui-link ui-btn");
		$("#game_menu").attr("class","ui-link ui-btn");
		$("#apps_menu").attr("class","ui-link ui-btn");
		$("#tryit_menu").attr("class","ui-link ui-btn");
		$("#books_menu").attr("class","ui-btn-active ui-link ui-btn");
	}
}); 
$('#menu-list').on('click','li',function(){
	//console.log("location:"+$(this).attr("location"));
	window.parent.location.href=$(this).attr("location");
})
</script>
